package com.jcli.jb51_net.article._175980开关按钮;

import javax.swing.*;
import java.util.List;

/**
 * @BelongsProject: novel_20230923
 * @BelongsPackage: com.jcli.jb51_net.article._175980开关按钮
 * @author li
 * @CreateTime: 2023-12-25  14:13
 * @Description: TODO
 * @version 1.0
 */
public class JTBUtils {
    private static final long CLICK_INTERVAL = 1000;

    public static boolean isFastClick(AbstractButton button) {
        Object userData = button.getClientProperty("lastClickTime");

        long currentTime = System.currentTimeMillis();
        button.putClientProperty("lastClickTime", currentTime);

        if (userData instanceof Long) {
            Long lastClickTime = (Long) userData;
            return currentTime - lastClickTime <= CLICK_INTERVAL;
        }

        return false;
    }
}
